Apache Commons PropertiesConfiguration escapes characters on Save [migrated]

Posted by Anuvrat on Programmers See other posts from Programmers or by Anuvrat
Published on 2011-06-25T19:55:02Z Indexed on 2011/06/26 0:30 UTC
Read the original article Hit count: 405

Filed under:

I am using the commons-configuration from apache commons library. I have a properties file which has properties like:

blog_loc=http://my.blog.com
blog_name="my blog name"

I open the properties file, change the blog_name property and save the file. The following are the lines of code I use:

PropertiesConfiguration propertyFile = new PropertiesConfiguration(propertyFileName);
propertyFile.setProperty(blog_name, "blog name");
propertyFile.save(propertyFileName + ".out");

Unfortunately, in the output file certain characters get escaped as follows:

blog_loc=http:\/\/my.blog.com
blog_name=\"blog name\"

Is there any way of preventing escaping of the above characters?

© Programmers or respective owner

Related posts about java